
<%@ page language="java" import="com.dps.dao.content.Contents" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="/WEB-INF/displaytag-12.tld" prefix="display" %>

<link rel="stylesheet" type="text/css" href='theme/style.css'>

<html>
  <head>  
    <title>View List of Programs</title>
  </head>

  <body>
  
  <script>
  	function selectedContent(){
  	
alert("inside selected cp");

  	var obj = document.listContents.contentURL;
	var flag = 0;

    if(obj.length > 0){
  	for(i=0;i<obj.length;i++){
	  	if(obj[i].checked)
	  	{
	  	contentURL = obj[i].value;
	  	alert(contentURL);
	  	flag = flag + 1;
	  	}
  	}
  	}
  	else if(obj.checked){
  	//alert("Single value on page.");
  	contentURL = obj.value;
	//alert(contentURL);
  	flag = flag + 1;
  	}
  	
  	if(flag == 0)
  	{alert("Please Select any content.");}else{
  	//alert(parent.listContents.contentUrl);// = contentURL;
  	window.opener.document.listContents.contentUrl.value = contentURL;
  	closeWindow();
  	}
 }
 
  	function closeWindow(){
  	//alert("Close Button Clicked");
  	self.close();
  	}
  </script>
  
  <form name="listContents" action="" method="post">
  <display:table id="row" pagesize="10" export="true" sort="list" name="contents" class="data_table" requestURI="viewContent.do">
   
   <display:column title="Content URL">
   <input type="radio" name="contentURL" value="contentView.do<%=((Contents) row).getContentURL()%>" />
   </display:column>
   
   <display:column title="Content Id" property="contentId" />
   
   <display:column title="Content Name">
   	<%--a href="viewContent.do?contentTypeId=<%=session.getAttribute("contentTypeId")%>&channelId=<%= request.getParameter("channelId")%>&programId=<%= request.getParameter("programId")%>&contentId=<%=((Contents) row).getContentId()%>" --%>
   	<%=((Contents) row).getContentName()%>
   	<%--/a --%>
   </display:column>
   
   <display:column title="Description" property="description" />

   <display:column title="Text" property="bodyContent" />
  
  <%--
  <display:column title="Content URL">
   contentView.do<%=((Contents) row).getContentURL()%>
  </display:column>
  --%>    
  </display:table>

  <Table width="100%" border="0">
  <Tr>
  	  <Td width="100%">&nbsp;
  	  </Td>
  	  <Td align="right">
		  <input type="button" name="Select" value="Select" onclick="selectedContent();" />
      </Td>
      <Td align="right">
		  <input type="button" name="Back" value="Back" onclick="history.go(-1)" />
      </Td>
      <Td align="right">
		  <input type="button" name="Close" value="Close" onclick="closeWindow();" />
      </Td>
  </Tr>
  </Table>
  </form>
  
  </body>
</html>
